<template>
  <div>
    <van-search v-model="kw" placeholder="请输入搜索关键词" />
    <goods-list :arr="arr"></goods-list>
  </div>
</template>

<script>
import axios from "axios";
import { reqSearch } from '../../http/http';
export default {
  data() {
    return {
      arr: [],
      kw: "",
    };
  },
  watch: {
    kw() {
      if(this.kw==""){
        this.arr=[];
        return;
      }
      reqSearch(this.kw).then((res) => {
          // console.log(res);
          this.arr=res.data.list?res.data.list:[];
        });
    },
  },
};
</script>

<style>
</style>